package com.itheima.test;

import com.itheima.util.ExportExcel;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import java.util.ArrayList;

/*
导出 测试
 缺啥补啥
 ExportExcel
 */
public class Demo01 {
    public static void main(String[] args) throws Exception {
        //创建 excel
        HSSFWorkbook excel = new HSSFWorkbook();
        //创建页签
        HSSFSheet sheet1 = excel.createSheet("页签1");
        HSSFSheet sheet2= excel.createSheet("页签2");
        //标题
        String  s1="第一个标题";
        String  s2="第二个标题";
        //表头  Stringg[]
        String[] strs1={"学号","姓名","年龄","生日","爱好"};
        String[] strs2={"工号","姓名","年龄","生日","工资"};
        //数据  ArrayList<Object[]>
        ArrayList<Object[]> list1 = new ArrayList<>();
        ArrayList<Object[]> list2 = new ArrayList<>();
        list1.add(new String[]{"0001","kunkun1","261","19961","女1"});
        list1.add(new String[]{"0002","kunkun1","262","19962","女2"});
        list1.add(new String[]{"0003","kunkun1","263","19963","女3"});
        list1.add(new String[]{"0004","kunkun1","264","19964","女4"});
        list1.add(new String[]{"0005","kunkun1","265","19965","女5"});

        list2.add(new String[]{"0001","签签1","261","19961","100"});

        list2.add(new String[]{"0002","签签2","262","19962","200"});
        list2.add(new String[]{"0003","签签3","263","19963","3000"});
        list2.add(new String[]{"0004","签签4","264","19964","4000"});
        list2.add(new String[]{"0005","签签5","265","19965","5000"});

        ExportExcel export1 = new ExportExcel(s1,strs1,list1);
        export1.export(excel,sheet1,0);
        ExportExcel export2 = new ExportExcel(s2, strs2, list2);
        export2.export(excel,sheet2,1);

    }

}
